import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    menu: [],
    count: 0
  },
  mutations: {
    SET_MENU(state, menu) {
      state.menu = menu
    },
    SET_PLUS(state) {
      state.count++
    }
  },
  actions: {
    // asyncMenu({commit,state}) {
    //   return new Promise((resolve,reject) => {
    //     commit('SET_MENU', state)
    //     resolve()
    //     if (!state) {
    //       reject()
    //     }
    //   })
    // }
    countPlus({commit}) {
      commit('SET_PLUS')
    }
  },
  getters: {

  }
})
